package com.xiaoying.server.publish.utils;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class DateUtil {

	
	private static SimpleDateFormat sdf = new SimpleDateFormat("/yyyy/MMdd/HHmm");
	private static SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
    /**
     * 获取时间多级路径
     * 格式[yyyy]/[MMdd]/[hhmm]
     * @param date
     * @return
     * @author ZJD
     */
	public static String getDirByDate(Date date){
    	return sdf.format(date); 
    }
	
	/**
	 * 获取上传时间的String
	 * 格式 yyyy-MM-dd HH:mm:ss
	 * @return String
	 * @author ZJD
	 */
	public static String getDateTimeByFormat(Date date){
		return sdf2.format(date);
	}
	
	
	
	@Test
	public void testit(){
		System.out.println(getDirByDate(new Date()));
	}
}
